/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "linea_ticket")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LineaTicket.findAll", query = "SELECT l FROM LineaTicket l"),
    @NamedQuery(name = "LineaTicket.findByIdLineaTicket", query = "SELECT l FROM LineaTicket l WHERE l.idLineaTicket = :idLineaTicket"),
    @NamedQuery(name = "LineaTicket.findByCantidad", query = "SELECT l FROM LineaTicket l WHERE l.cantidad = :cantidad"),
    @NamedQuery(name = "LineaTicket.findByIva", query = "SELECT l FROM LineaTicket l WHERE l.iva = :iva"),
    @NamedQuery(name = "LineaTicket.findByDescuento", query = "SELECT l FROM LineaTicket l WHERE l.descuento = :descuento"),
    @NamedQuery(name = "LineaTicket.findByTotal", query = "SELECT l FROM LineaTicket l WHERE l.total = :total")})
public class LineaTicket implements Serializable {
    @JoinColumn(name = "ALMACEN", referencedColumnName = "ID_ALMACEN")
    @ManyToOne(optional = false)
    private Almacen almacen;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_LINEA_TICKET")
    private Integer idLineaTicket;
    @Basic(optional = false)
    @NotNull
    @Column(name = "CANTIDAD")
    private int cantidad;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "IVA")
    private BigDecimal iva;
    @Basic(optional = false)
    @Column(name = "DESCUENTO")
    private BigDecimal descuento;
    @Basic(optional = false)
    @NotNull
    @Column(name = "TOTAL")
    private BigDecimal total;
    @JoinColumn(name = "TICKET", referencedColumnName = "ID_TICKET")
    @ManyToOne(optional = false)
    private Ticket ticket;
    @JoinColumn(name = "PRODUCTO_TALLA", referencedColumnName = "ID_PRODUCTO_TALLA")
    @ManyToOne(optional = false)
    private ProductoTalla productoTalla;

    public LineaTicket() {
    }

    public LineaTicket(Integer idLineaTicket) {
        this.idLineaTicket = idLineaTicket;
    }

    public LineaTicket(Integer idLineaTicket, int cantidad, BigDecimal iva, BigDecimal descuento, BigDecimal total) {
        this.idLineaTicket = idLineaTicket;
        this.cantidad = cantidad;
        this.iva = iva;
        this.descuento = descuento;
        this.total = total;
    }

    public Integer getIdLineaTicket() {
        return idLineaTicket;
    }

    public void setIdLineaTicket(Integer idLineaTicket) {
        this.idLineaTicket = idLineaTicket;
    }

    public int getCantidad() {
        return cantidad;
    }

    public void setCantidad(int cantidad) {
        this.cantidad = cantidad;
    }

    public BigDecimal getIva() {
        return iva;
    }

    public void setIva(BigDecimal iva) {
        this.iva = iva;
    }

    public BigDecimal getDescuento() {
        return descuento;
    }

    public void setDescuento(BigDecimal descuento) {
        this.descuento = descuento;
    }

    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    public Ticket getTicket() {
        return ticket;
    }

    public void setTicket(Ticket ticket) {
        this.ticket = ticket;
    }

    public ProductoTalla getProductoTalla() {
        return productoTalla;
    }

    public void setProductoTalla(ProductoTalla productoTalla) {
        this.productoTalla = productoTalla;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLineaTicket != null ? idLineaTicket.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LineaTicket)) {
            return false;
        }
        LineaTicket other = (LineaTicket) object;
        if ((this.idLineaTicket == null && other.idLineaTicket != null) || (this.idLineaTicket != null && !this.idLineaTicket.equals(other.idLineaTicket))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.LineaTicket[ idLineaTicket=" + idLineaTicket + " ]";
    }

    public Almacen getAlmacen() {
        return almacen;
    }

    public void setAlmacen(Almacen almacen) {
        this.almacen = almacen;
    }
    
}
